update internals 1

Documentation Version for Comments and Changes

You are invited to make any changes...add any comments.

Changes will `eventually` be merged into the offical documentation.

Leave any commnents here...

...

... back to index page OE documentation



Euphoria Internals

The interpreter has four binary components:

  • Interpreter
  • Translator
  • Backend
  • Library

The Euphoria interpreter has two parts: the frontend and the backend. The frontend is a parser that converts source-code into a set of Intermediate Language (IL) instructions. The backend then takes the IL instructions and executes the program.

When the interpreter executes source-code, the frontend parses and prepares the code, and then the backend executes the code.

When the shrouder executes source-code, only the frontend is run producing an .il file. This .il file may be run by the backend as an independent step to execute the program.

When the binder executes source-code, the .il instructions produced by the frontend are combined with the backend to produce a stand-alone executable program. The executable program may then be run independetly at any time.

When the translator executes source-code, the .il instructions are translated into C-code. This C-code is compiled with an installed C compiler producing an executable program.

The library is called by the backend for the many builtins included in Euphoria.

The Euphoria Data Structures

The Euphoria representation of a Euphoria Object

Every Euphoria object is stored as-is. A special unlikely floating point value is used for NOVALUE. NOVALUE signifies that a variable has not been assigned a value or the end of a sequence.

The C Representation of a Euphoria Object

Every Euphoria object is either stored as is, or as an encoded pointer. A Euphoria integer is stored in a 32-bit signed integer. If the number is too big for a Euphoria integer, it is assigned to a 64-bit double float in a structure and an encoded pointer to that structure is stored in the said 32-bit memory space. Sequences are stored in a similar way.

 
 32 bit number range: 
  0X8      0XA      0XC      0XE      0X0      0X2      0X4      0X6      0X8 
-4*2^29  -3*2^29  -2*2^29-1  -2^29   0*2^29   1*2^29   2*2^29   3*2^29 4*2^29  
   *--------*--------*--------*--------*--------*--------*--------*--------o 
                     o NOVALUE = -2*2^29-1 
		     o<-----------ATOM_INT---------[-2*2^29..4*2^29)------>o 
	    |<----------------ATOM_DBL-------[-3*2^29..4*2^29)------------>o 
-->|        |<-- IS_SEQUENCE [-4*2^29..-3*2^29) 
-->|                 o<--- IS_DBL_OR_SEQUENCE [-4*2^29..-2*2^29-1) 
-->|sequence|<------- 
            |<------------------  atom   --------------->| 
    ------->| double |<--------   
                     |<--------     integer    --------->| 
   |<--------------------- object ---------------------->|		      
 

Euphoria integers are stored in object variables as-is. An object variable is a four byte signed integer. Legal integer values for Euphoria integers are

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu